Skip to content

test: add integration tests and test dependencies#14

Merged
iamnivekx merged 3 commits intomainfrom
test/add-integration-tests
Jan 7, 2026
Merged

test: add integration tests and test dependencies#14
iamnivekx merged 3 commits intomainfrom
test/add-integration-tests

Conversation

@iamnivekx
Copy link
Owner

@iamnivekx iamnivekx commented Jan 6, 2026

Summary

This PR adds integration tests and necessary test dependencies to improve test coverage.

Changes

  • ✅ Add integration test for axum-otel middleware (tests/integration.rs)
  • ✅ Add unit tests for get_resource function in tracing-opentelemetry
  • ✅ Add dev-dependencies (tokio, reqwest, tower) to axum-otel crate for testing

Testing

  • Integration test passes
  • Unit tests pass
  • All existing tests still pass

- Add integration test for axum-otel middleware
- Add unit tests for resource creation
- Add dev-dependencies (tokio, reqwest, tower) to axum-otel for testing
@gemini-code-assist
Copy link

Summary of Changes

Hello @iamnivekx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the test coverage for the OpenTelemetry integration within the project. It introduces an integration test for the axum-otel middleware to confirm its operational integrity and adds unit tests for the tracing-opentelemetry crate's resource creation logic, ensuring robust and reliable tracing capabilities.

Highlights

  • Integration Testing: An integration test has been added for the axum-otel middleware to verify its basic functionality and ensure it compiles and runs without panicking when handling HTTP requests.
  • Unit Testing: Unit tests have been introduced for the get_resource function within crates/tracing-opentelemetry/src/resource.rs to ensure correct resource creation with service names and custom attributes.
  • Development Dependencies: tokio, reqwest, and tower have been added as development dependencies to the axum-otel crate, primarily to support the new integration tests.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds valuable test coverage. It introduces integration tests for the axum-otel middleware and unit tests for resource creation, which is a great step towards ensuring the reliability of the library. My review includes a suggestion to improve the robustness of the new integration test to prevent flakiness and another to make the unit test more comprehensive. Overall, this is a solid contribution.

@iamnivekx
Copy link
Owner Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces integration tests for the axum-otel middleware and unit tests for the get_resource function, which is a great step towards improving test coverage and ensuring reliability. The changes are well-structured, adding necessary development dependencies and implementing clear, concise tests. I have one suggestion to improve the robustness of the new integration test.

@iamnivekx
Copy link
Owner Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds valuable integration and unit tests, improving the project's test coverage. The new dependencies in axum-otel/Cargo.toml are appropriate for the testing goals. I've provided a few suggestions to enhance code style for better maintainability and to make the new integration test more robust by verifying the actual tracing output.

@iamnivekx
Copy link
Owner Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds valuable integration and unit tests, significantly improving test coverage. The overall approach is good. My feedback focuses on making the new tests more robust and reliable. Specifically, for the axum-otel integration test, I've suggested changes to avoid potential flakiness by using a synchronous exporter and improving the assertions to properly validate the middleware's behavior. For the tracing-opentelemetry unit test, I've proposed a small refactoring to enhance readability. These adjustments will strengthen the new tests.

@iamnivekx
Copy link
Owner Author

/gemini review

@iamnivekx iamnivekx force-pushed the test/add-integration-tests branch from ef69c80 to cc2b5db Compare January 7, 2026 13:53
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds valuable integration and unit tests, significantly improving test coverage. The new integration test for the axum-otel middleware is comprehensive and well-structured. However, it modifies global state for both tracing and OpenTelemetry, which can lead to flaky tests when run in parallel. I've provided a few suggestions to run the test serially and handle global state more robustly to ensure test stability. The new unit tests for the get_resource function are a great addition and are well-written.

@iamnivekx
Copy link
Owner Author

/gemini summary

@gemini-code-assist
Copy link

Summary of Changes

This pull request significantly enhances the project's test coverage by introducing new integration and unit tests. The primary goal is to improve the reliability and robustness of the OpenTelemetry tracing capabilities, specifically for the axum-otel middleware and the tracing-opentelemetry crate's resource creation logic. These additions ensure that the tracing components function as expected and correctly capture span data and resource attributes.

Highlights

  • axum-otel Integration Test: A new integration test (crates/axum-otel/tests/integration.rs) has been added to verify the axum-otel middleware's functionality, including span creation, parent-child relationships, and HTTP status code attributes using an in-memory OpenTelemetry exporter.
  • tracing-opentelemetry Unit Tests: Unit tests have been introduced for the get_resource function in crates/tracing-opentelemetry/src/resource.rs to ensure correct resource creation with service names and custom attributes.
  • Development Dependencies: Several development dependencies, including http-body-util, opentelemetry_sdk, reqwest, tokio, tower, tracing-opentelemetry, and tracing-subscriber, were added to the axum-otel crate to support the new integration tests.
Changelog
  • Cargo.lock
    • Added http-body-util, opentelemetry_sdk, reqwest, tokio, tower, tracing-opentelemetry, tracing-subscriber as dependencies for axum-otel.
    • Added tokio and tokio-stream for other packages.
  • Cargo.toml
    • Added http-body-util as a workspace dependency.
  • crates/axum-otel/Cargo.toml
    • Added http-body-util, opentelemetry_sdk (with testing feature), reqwest, tokio, tower, tracing-opentelemetry, tracing-subscriber (with registry feature) as dev-dependencies.
  • crates/axum-otel/tests/integration.rs
    • New file containing an integration test for the axum-otel middleware.
    • Sets up an axum router with TraceLayer using AxumOtelSpanCreator, AxumOtelOnResponse, and AxumOtelOnFailure.
    • Configures an InMemorySpanExporter to capture spans.
    • Sends a GET / request and asserts the HTTP status code.
    • Verifies the creation of request and handler spans, their parent-child relationship, and the http.status_code attribute.
  • crates/tracing-opentelemetry/src/resource.rs
    • Added a #[cfg(test)] module with a unit test for the get_resource function.
    • Asserts that service.name, env, and version attributes are correctly set in the created resource.
Activity
  • gemini-code-assist[bot] provided an initial summary of the pull request.
  • iamnivekx requested multiple /gemini review and /gemini summary commands.
  • gemini-code-assist[bot] provided several review comments, including suggestions for making the integration test more robust (handling race conditions, error handling, server shutdown, using with_simple_exporter, robust span assertions, serializing tests), improving the unit test (asserting all attributes, using helper closure), and general code quality (sorting dependencies and use statements).
  • iamnivekx responded to a suggestion regarding try_init().expect() in tests, stating that expect() is intentional for unit tests to fail fast.

@iamnivekx
Copy link
Owner Author

@codex review

@iamnivekx iamnivekx merged commit a7cd9aa into main Jan 7, 2026
5 checks passed
@iamnivekx iamnivekx deleted the test/add-integration-tests branch January 7, 2026 14:05
@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Keep it up!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant